home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Developer Kit / QuickTime 2.0 Developer Kit.iso / mac / MAC / Programming Stuff / Sample Code / Music Architecture / Embedding Instruments / BigEasy / BigEasyUtils.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-03-03  |  1.3 KB  |  77 lines  |  [TEXT/KAHL]

  1. /* file: BigEasyUtils.c
  2.   *
  3.   * Started 25 January 1992, more or less.
  4.   *
  5.   * Little Extras that go
  6.   * well with BigEasy.
  7.   *
  8.   */
  9.  
  10.  
  11. /*----------------
  12.     Inclusions
  13. ----------------*/
  14.  
  15.  
  16. #include "BigEasy2.h"
  17. #include "BigEasyUtils.h"
  18.  
  19.  
  20. /*----------------
  21.     Dofu
  22. ----------------*/
  23.  
  24.  
  25. void SetMenuItemRange(short loRef,short hiRef,short active,short bulletRef)
  26. /*
  27.  * Set the range of menu-refs passed to either
  28.  * active or inactive (±1) and bullet the
  29.  * one that matches 'bulletref'
  30.  */
  31.     {
  32.     short i;
  33.  
  34.     for(i = loRef; i<= hiRef; i++)
  35.         SetMenuItem(i,active,SignIt(bulletRef == i),'•',nil);
  36.     }
  37.  
  38.  
  39.  
  40. #ifdef THINK_C
  41.     long RememberThis(long what,short which)
  42.     /*
  43.      * To store something, pass what, and a negative "which".
  44.      * To retrieve it, pass the positive which.
  45.      */
  46.         {
  47.         asm    {
  48.             LEA        @them,A0
  49.             MOVE    which,D0
  50.             ADD        D0,D0
  51.             ADD        D0,D0
  52.             BMI.S    @stash
  53.             ADDA    D0,A0
  54.             MOVE.L    (A0),D0
  55.             BRA.S    @done
  56.     @stash:
  57.             SUBA    D0,A0
  58.             MOVE.L    what,(A0)
  59.             MOVE.L    what,D0
  60.             BRA.S    @done
  61.     
  62.     @them    DC.L    0,0,0,0,0,0,0,0,0,0,0
  63.     
  64.     @done:
  65.             }
  66.         }
  67. #endif
  68.  
  69.  
  70. void CenterRect(Rect *centerThis,Rect *insideThis)
  71.     {
  72.     OffsetRect(centerThis,
  73.             (insideThis->left + insideThis->right - centerThis->left - centerThis->right)>>1,
  74.             (insideThis->top + insideThis->bottom - centerThis->top - centerThis->bottom)>>1);
  75.     }
  76.  
  77.